<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 力扣21 -->
    <!-- 将两个升序链表 合并为 一个升序链表 返回 -->
    <script>
        function NodeList(val) {
            this.value = val;
            this.next = null;
        }
        function mergeTwoLists(l1, l2) {
            var dummy = new NodeList();
            var p = dummy;
            var p1 = l1;
            var p2 = l2;
            while (p1 != null && p2 != null) {
                if (p1.value < p2.value) {
                    p.next = p1;
                    p1 = p1.next;
                } else {
                    p.next = p2;
                    p2 = p2.next
                }
                p = p.next;
            }
            if (p1 != null) {
                p.next = p1;
            }
            if (p2 != null) {
                p.next = p2;
            }
            return dummy.next;
        }
    </script>

</body>

</html>